package com.arrake.pojo;

public class DocxParagraph {
    private String preParagraph;
    private String sufParagraph;
    private boolean isCenter ;

    public DocxParagraph() {
        preParagraph = "<w:p>\n";
        sufParagraph = "</w:p>\n";
        isCenter = false;
    }

//    setCenter(boolean isNO)段落居中吗?默认否
    public void setCenter(){
        preParagraph = preParagraph + "            <w:pPr>\n" +
                "                <w:jc w:val=\"center\"/>\n" +
                "            </w:pPr>\n";
        isCenter = true;
    }
//    addPicture(DocxPicture picture)拼接一个图片
    public DocxParagraph addPicture(DocxPicture picture) {
        preParagraph = preParagraph + picture.getDocxString();
        return this;
    }
//    addText(DocxText text)拼接一个文本对象
    public DocxParagraph addText(DocxText text) {
        preParagraph = preParagraph + text.getPreText()+text.getSufText();
        return this;
    }

    public String getPreParagraph() {
        return preParagraph;
    }

    public String getSufParagraph() {
        return sufParagraph;
    }

    @Override
    public String toString() {
        return "DocxParagraph{" +
                "preParagraph='" + preParagraph + '\'' +
                ", sufParagraph='" + sufParagraph + '\'' +
                ", isCenter=" + isCenter +
                '}';
    }
}
